<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=s, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="t.css">
</head>
<body>
    <script>
        function sort(arr,begin,end){
            if(begin < end){
                let i = begin;
                let j = end;
                let empty = arr[begin];
                while(i < j){
                    while(arr[j] > empty && i < j){
                        j --;
                    }
                    arr[i] = arr[j];
                    while(arr[i] < empty && i < j){
                        i ++;
                    }
                    arr[j] = arr[i];
                }
                arr[i] = empty;
                sort(arr,begin,i-1);
                sort(arr,i+1,end);
            }else{
                return;
            }
        }
        let arr = [2,3,1,4,8,7,9,6];
        sort(arr,0,7);
        console.log(arr);

    </script>
</body>
</html>